package org.example.deep.controller;

import org.example.deep.utils.json.ResultJson;
import org.example.deep.service.IElecDeepService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

import javax.servlet.http.HttpServletResponse;

/**
 * @author jianxin.wei
 * @description
 * @date 2024/9/10 10:38
 */
@RestController
@RequestMapping("/deep")
public class ElecDeepController {

    @Autowired
    private IElecDeepService elecDeepService;

    @PostMapping("/upload")
    public ResultJson upload(@RequestParam("file") MultipartFile file) {
        return elecDeepService.upload(file);
    }

    @PostMapping("/uploadTemplate")
    public void uploadTemplate() {
        elecDeepService.uploadTemplate();
    }

    @GetMapping("/history")
    public ResultJson history() {
        return elecDeepService.history();
    }

    @GetMapping("/download")
    public void download(@RequestParam("fileName") String fileName, HttpServletResponse response) {
        elecDeepService.download(fileName, response);
    }

    @GetMapping("/downloadTemplate")
    public void downloadTemplate( HttpServletResponse response) {
        elecDeepService.downloadTemplate( response);
    }

    /*@GetMapping("/total")
    public ResultJson total() {
        return elecDeepService.total();
    }*/

}
